<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
<style>
*{
	margin: 0px;
	padding: 0px;
}
.wrap {
	width: 600px; 
	height: 350px;
	position: relative;
	margin: 50px auto 0px;
	border: 1px solid #333;
}
.draggable {
	width: 100px; height: 100px; background: red; position: absolute;
	left: 0px; top:0px;
}
</style>
<script src="cookie.js"></script>
<script src="event.js"></script>
<script src="style.js"></script>
<script src="drag.js"></script>
<script>
window.onload = function(){
	var oDiv1 = document.getElementById('div1');
	oDiv1.style.left = (getCookie(oDiv1.id + '_left') || 0) + 'px';
	oDiv1.style.top = (getCookie(oDiv1.id + '_top') || 0) + 'px';
	var oDiv2 = document.getElementById('div2');
	dragXY(oDiv1, {
		limited: true,
		cling: 0,
		fn: function(){
			var oDate = new Date();
			oDate.setDate(oDate.getDate() + 5);
			setCookie(oDiv1.id + '_left', oDiv1.offsetLeft, oDate);
			setCookie(oDiv1.id + '_top', oDiv1.offsetTop, oDate);
		}
	});
	dragXY(oDiv2, {limited: false});
</script>
</head>
<body>
<div class="wrap">
	<div id="div1" class="draggable"></div>
	<div id="div2" class="draggable" style="left:100px; top: 100px; background-color: blue"></div>
</div>
</body>
</html>
